import smtplib

# Import the email modules we'll need
from email.mime.text import MIMEText

# Open a plain text file for reading.  For this example, assume that
# the text file contains only ASCII characters.
#fp = open(textfile, 'rb')
# Create a text/plain message
#msg = MIMEText(fp.read())
msg = MIMEText('sagdfhfgjh')
'''
SERVER = "localhost"
FROM = 'hongwu.ma@gmail.com'
TO = ["hma2@inf.ed.ac.uk"] # must be a list
SUBJECT = "Hello!"
TEXT = "This message was sent with Python's smtplib."
message = """\
From: %s
To: %s
Subject: %s
%s
""" % (FROM, ", ".join(TO), SUBJECT, TEXT)
'''

#fp.close()

# me == the sender's email address
# you == the recipient's email address
msg['Subject'] = 'The contents of '
msg['From'] = 'hongwu.ma@gmail.com'
msg['To'] = 'hma2@inf.ed.ac.uk'

# Send the message via our own SMTP server, but don't include the
# envelope header.
s = smtplib.SMTP('localhost')
s.login('ehmn@csb.inf.ed.ac.uk','mhw314') #using hserver
s.sendmail('ehmn@csb.inf.ed.ac.uk', ['hma2@inf.ed.ac.uk'], msg.as_string())
s.quit()